﻿using MediatR;
using System.WXT.Domain;
using System.WXT.Infrstructre.Interface;
using System.WXT.WebAPI.Application.Command.WorkerCommand;

namespace System.WXT.WebAPI.Application.CommandHandlers.WorkerCommandHandlers
{
    public class WorkerBackFillCommandHandlers:IRequestHandler<WorkerBackFillCommand,Worker>
    {
        protected readonly IWorkerRepository workerRepository;

        public WorkerBackFillCommandHandlers(IWorkerRepository workerRepository)
        {
            this.workerRepository = workerRepository;
        }
        /// <summary>
        /// 工人反填
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<Worker> Handle(WorkerBackFillCommand request, CancellationToken cancellationToken)
        {
            var list = await workerRepository.GetBaby(request.workerId);
            return list;
        }
    }
}
